Learn R Programming

DirichletMultinomial (version 1.14.0)

model components: Access model components.

Description

The accessors mixture and mixturewt return information about the esimtated Dirichlet comonents of the fitted model. mixture returns a sample x component matrix of estimated values, mixturewt reta matrix of

Usage

mixture(object, ..., assign=FALSE) mixturewt(object, ...) goodnessOfFit(object, ...) laplace(object, ...) "AIC"(object, ..., k = 2) "BIC"(object, ...)
"fitted"(object, ..., scale=FALSE) "predict"(object, newdata, ..., logevidence=FALSE) "fitted"(object, ...) "predict"(object, newdata, ..., assign=FALSE) "summary"(object, ...)

Arguments

object
An instance of class dmn.
newdata
A matrix of new sample x taxon data to be fitted to the model of object.
...
Additional arguments, available to methods, when applicable.
assign
logical(1) indicating whether the maximum per-sample mixture component should be returned (assign=FALSE), or the full mixture matrix (assign=TRUE).
scale
logical(1) indicating whether fitted values should be returned unscaled (default, scaled=FALSE) or scaled by the variability of mixturewt parameter theta.
logevidence
logical(1) indicating whether posterior probability (default, logevidence=FALSE) or log evidence logical=TRUE should be returned.
k
ignored.

Value

mixture with assign=FALSE returns a matrix of sample x Dirichlet component estimates. With assign=TRUE mixture returns a named vector indexing the maximal Dirichlet component of each sample.mixturewt returns a matrix with rows corresponding to mixture components, and columns pi (component weight) and theta (component variability). Small values of theta correspond to highly variable components.goodnessOfFit returns a named numeric vector of measures of goodness of fit.laplace, AIC, and BIC return the corresponding measures of goodness of fit.

Examples

Run this code
data(fit)
best <- fit[[4]]
mixturewt(best)
head(mixture(best), 3)
head(mixture(best, assign=TRUE), 3)
goodnessOfFit(best)

fl <- system.file(package="DirichletMultinomial", "extdata",
                  "Twins.csv")
count <- t(as.matrix(read.csv(fl, row.names=1)))
data(bestgrp)
bestgrp
head(predict(bestgrp, count))

Run the code above in your browser using DataLab